package Package.Network_Programming.InetAddress;

import java.net.InetAddress;
import java.net.UnknownHostException;

public  class InetAddresss {
    public static final void InetAddresss() throws UnknownHostException {
//        InetAddress：此类表示Internet协议（IP）地址
//方法名 说明
//static InetAddress getByName(String host)确定主机名称的IP地址。主机名称可以是机器名称，也可以是IP地址
        InetAddress iad = InetAddress.getByName("DESKTOP-QIE48QV");
        System.out.println(iad);
//String getHostName() 获取此IP地址的主机名
        System.out.println(iad.getHostName());
//String getHostAddress() 返回文本显示中的IP地址字符串
        System.out.println(iad.getHostAddress());

    }
}
